<?php

/**
 *      [CodeJm!] Author CodeJm[codejm@163.com].
 *
 *      
 *      $Id: Combo.php 2016-03-31 15:42:44 codejm $
 */

class ComboModel extends \Core_CMode {

    public $_table = '`yaf_combo`';

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
            'id' => '套餐id', 
            'name' => '套餐名称', 
            'price' => '价格', 
            'content' => '套餐内容', 
            'sort' => '排序',
            'status' => '状态', 
            'addtime' => '添加时间',
        );
    }

    /**
     * 楠岃瘉瑙勫垯
     *
     */
    public function rules() {
        return array(
            'default'=> array(
                array('name', 'required|maxlength[30]'),
                array('price', 'required|maxlength[10]|float|greaterthan[0]'),
                array('content', 'required'),
                array('sort', 'integer')
            ),
        );
    }

    /**
     * 鎵归噺鍒犻櫎
     *
     */
    public function delCombos($ids) {
        $ids_str = implode(',', $ids);
        $where = 'id IN ('.$ids_str.')';
        return $this->delete($where);
    }
}

?>
